import { get } from 'lodash-es'

export class PrintTemplateItem {
  id?: string
  hotel_id?: string
  print_template_id?: string
  display_type = 0
  margin_left = 0
  font = 'A'
  text_align = 'LT'
  text_width = 0
  text_height = 0
  text_style = 'NORMAL'
  content?: string
  sequence?: number
  created_id?: string
  updated_id?: string
  created_at?: string
  updated_at?: string
  version?: number;
  [key: string]: any

  constructor(data?: PrintTemplateItem) {
    this.init(data)
  }
}

PrintTemplateItem.prototype.init = function init(data?: PrintTemplateItem) {
  this.id = get(data, 'id')
  this.hotel_id = get(data, 'hotel_id')
  this.print_template_id = get(data, 'print_template_id')
  this.display_type = get(data, 'display_type', 0)
  this.margin_left = get(data, 'margin_left', 0)
  this.font = get(data, 'font', 'A')
  this.text_align = get(data, 'text_align', 'LT')
  this.text_width = get(data, 'text_width', 0)
  this.text_height = get(data, 'text_height', 0)
  this.text_style = get(data, 'text_style', 'NORMAL')
  this.content = get(data, 'content')
  this.sequence = get(data, 'sequence', 1)
  this.created_id = get(data, 'created_id')
  this.updated_id = get(data, 'updated_id')
  this.created_at = get(data, 'created_at')
  this.updated_at = get(data, 'updated_id')
  this.version = get(data, 'version')
}
